﻿using System;
using System.Xml.Linq;
using IcicleFramework.Actions;
using IcicleFramework.Components.Actions;

namespace IcicleFramework.GameServices
{
    public interface IActionFactory : IGameService
    {
        /// <summary>
        /// Creates a new <see cref="IAction"/> using the information provided in the <see cref="XElement"/>.
        /// </summary>
        /// <param name="element">The <see cref="XElement"/> containing the information required for this <see cref="IAction"/>.</param>
        /// <returns>The requested <see cref="IAction"/>, or null if not <see cref="IAction"/> could be generated from the given <see cref="XElement"/>.</returns>
        IAction GenerateAction(XElement element);

        /// <summary>
        /// Creates a new <see cref="IAction"/> of Type type, with default/uninitialized values.
        /// </summary>
        /// <param name="type">The type of <see cref="IAction"/> to create.</param>
        /// <returns>The created <see cref="IAction"/> with default/uninitialized values, or null if no <see cref="IAction"/> matching the given type could be found.</returns>
        IAction GenerateAction(Type type);

        /// <summary>
        /// Generates and returns a stock <see cref="IGameAction"/> of type T.
        /// </summary>
        /// <typeparam name="T">The type of <see cref="IGameAction"/> to generate.</typeparam>
        /// <returns>The generated <see cref="IGameAction"/> of type T, with default settings.</returns>
        T GenerateAction<T>() where T : IGameAction, new();
    }
}
